package edu.bu.cs673.superkids123.children.model.resources;

import java.net.URL;

import javax.swing.ImageIcon;

/**
 * 
 * Class ImageFactory
 * 
 * This class constructs an ImageIcon from an image id.
 * 
 * @author David Bardwell
 *
 */
public class ImageFactory {

	public ImageIcon createImage(String imageId) {
		String imagePath = 
			ChildrenResource.rootChildrenResourcePath + "images/" + imageId;
		URL image = getClass().getResource(imagePath);
		if (image == null) {
			image = getClass().getResource(ChildrenResource.rootChildrenResourcePath + 
					                         "images/planetcute/QuestionMark.png");
		}
		return new ImageIcon(image);
	}
}
